<template>
  <div>
    <div>{{ double }}</div>
  </div>
</template>

<script>
import { mapState } from "pinia";
import { useCounterStore } from "../../store/myPinia";

export default {
  computed: {
    // 允许访问组件内部的 this.counter
    // 与从 store.counter 读取相同
    ...mapState(useCounterStore, {
      // 您还可以编写一个访问 store 的函数
      double: (store) => store.counter * 2,
    }),
  },
  methods: {},
};
</script>

<style lang="scss" scoped></style>
